package com.iyunsir.parts.controller;

import com.iyunsir.common.vo.Result;
import com.iyunsir.parts.entity.Parts;
import com.iyunsir.parts.service.PartsService;
import com.iyunsir.parts.vo.PartsQuery;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import java.util.List;

@Controller
@RequestMapping("/parts")
public class PartsController {
    @Autowired
    private PartsService partsService;

    @ResponseBody
    @GetMapping("list")
    public Result<Object> getPartsList(PartsQuery param){
        List<Parts> list = partsService.getPartsList(param);
        Long count = partsService.countPartsList(param);
        return Result.success(list,count);
    }

}
